def quick(list):
    if len(list) < 2:
        return list
    tmp = list[0]  # 临时变量 可以取随机值
    left = [x for x in list[1:] if x <= tmp]  # 左列表
    right = [x for x in list[1:] if x > tmp]  # 右列表
    return quick(left) + [tmp] + quick(right)


li = [4, 3, 7, 5, 8, 2]

print(quick(li))
